﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BestCode.Wpf.ViewModel;

namespace BestCode.Creds.Entities
{
    public class EntityId : INotifyPropertyChanged
    {
        private int id;

        public virtual bool IsAssigned
        {
            get
            {
                return Id != 0;
            }
        }

        public virtual int Id
        {
            get { return id; }
            set
            {
                id = value;
                this.FirePropertyChanged("Id");
            }
        }

        public virtual event PropertyChangedEventHandler PropertyChanged;

        public virtual void FirePropertyChanged(string prop)
        {
            if(PropertyChanged!=null)
                PropertyChanged(this, new PropertyChangedEventArgs(prop));
        }
    }
}
